﻿using Dal;
using IBll;
using IDal;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bll
{
    public class PgassBll : IPgassBll
    {
         public PgassBll(IStateDal<Stare> stateD, IStateDal<StarePtea> state, IStateDal<Pgass> stat)
        {
            StateD = stateD;
            State = state;
            Stat = stat;
        }

        public IStateDal<Stare> StateD { get; }
        public IStateDal<StarePtea> State { get; }
        public IStateDal<Pgass> Stat { get; }

  

       public PgassdTO Showw(int index, int size)
       {
           var stare = StateD.GetValues();
           var state = State.GetValues();
           var stat= Stat.GetValues();
           var linq = from a in state
                      join b in state
                      on a.StarePteaId equals b.StarePteaId
                      join c in stat
                      on a.StarePteaId equals c.StarePteaId
                      select new {
                        a.StarePteaId,
                        b.StarePteaName,
                         c.StareId,
                         c.PgassId,
                         c.StareName,
                      };
            int K=linq.Count();
            var u = linq.OrderBy(x => x.PgassId).Skip((index - 1)).Take(size);
              return new PgassdTO { Count=K,Mumbe=u };





        }

    }
}
